{% extends '@WebsiteBundle/layout/baselayout.html.twig' %}

{% block body_main %}
	{{ parent() }}
	<div class="page">
		{{ render(path('app_header', {"route":route})) }}
		<div class="page-wrapper">
			<div class="page-body">
				<div class="container-xl">
					<div class="row row-deck row-cards">
						<div class="col-lg-2">
							{{ render(path('app_user_userNav', {route:route})) }}
						</div>
						<div class="col-lg-10">
							<div class="card">
								<div class="card-header">
									<a href="javascript:window.history.back();">
										<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrow-back" width="24" height="24" viewbox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
											<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
											<path d="M9 11l-4 4l4 4m-4 -4h11a4 4 0 0 0 0 -8h-1"></path>
										</svg>
									</a>
									<span class="ml-2">{{ courseInfo['name'] }}</span>
								</div>
								<div class="card-body">
									{% if chapterTree %}
										{% if pathCount == 0 %}
											<div class="accordion" id="accordion">
												<div class="accordion-body p-0">
													<ul class="list-group">
														{% for item in chapterTree[0] %}
															<li class="list-group-item">
																{% if item['video'] %}
																	<a href="{{ path('app_learn_detail', {chapterId:item['video']['chapterId']}) }}" target="_blank">
																		{{ loop.index }}、{{ item['name'] }}</a>
																	<a class="btn btn-normal btn-sm " href="{{ path('app_learn_detail', {chapterId:item['video']['chapterId']}) }}" target="_blank">
																		{% if item['studyWay'] == 2 %}播  放{% else %}进入直播
																		{% endif %}
																	</a>
																{% else %}
																	{% if item['studyWay'] == 2 %}
																		<span class="name">
																			{{ loop.index }}、{{ item['name'] }}</span>
																	{% else %}
																		<a class="name" href="{{ path('app_learn_detail', {chapterId:item['id']}) }}" target="_blank">
																			{{ loop.index }}、{{ item['name'] }}</a>
																	{% endif %}
																	<a class="btn btn-disabled btn-sm" href="javascript:;">暂无视频</a>
																{% endif %}
															</li>
														{% endfor %}
													</ul>
												</div>
											</div>
										{% endif %}
										{% if pathCount > 0 %}
											<div class="accordion" id="accordion">
												{% for key, item in chapterTree[0] %}
													{% set topIndex=loop.index %}
													{% if chapterTree[item['id']] is defined %}
														<div class="accordion-item">
															<h2 class="accordion-header" id="heading-{{ item['id'] }}">
																<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-{{ item['id'] }}" aria-expanded="false">
																	{{ item['name'] }}
																</button>
															</h2>
															<div id="collapse-{{ item['id'] }}" class="accordion-collapse collapse" data-bs-parent="#accordion" style="">
																<div class="accordion-body p-0">
																	<ul class="list-group">
																		{% for item2 in chapterTree[item['id']] %}
																			<li class="list-group-item">
																				{% if item2['video'] %}
																					<a class="name" href="{{ path('app_learn_detail', {chapterId:item2['video']['chapterId']}) }}" target="_blank">
																						{{ topIndex }}-{{ loop.index }}、{{ item2['name'] }}</a>
																					<a class="btn btn-normal btn-sm" href="{{ path('app_learn_detail', {chapterId:item2['video']['chapterId']}) }}" target="_blank">
																						{% if item['studyWay'] == 2 %}播  放{% else %}进入直播
																						{% endif %}
																					</a>
																				{% else %}
																					<span class="name">
																						{{ topIndex }}-{{ loop.index }}、{{ item2['name'] }}</span>
																					<a class="btn  btn-disabled btn-sm" href="javascript:;">暂无视频</a>
																				{% endif %}
																			</li>
																		{% endfor %}
																	</ul>
																</div>
															</div>
														</div>
													{% else %}
														<div class="accordion-body p-0">
															<ul class="list-group">
																<li class="list-group-item">
																	{% if item['video'] %}
																		<a class="name" href="{{ path('app_learn_detail', {chapterId:item['video']['chapterId']}) }}" target="_blank">
																			{{ loop.index }}、{{ item['name'] }}</a>
																		<a class="btn  btn-normal btn-sm" href="{{ path('app_learn_detail', {chapterId:item['video']['chapterId']}) }}" target="_blank">
																			{% if item['studyWay'] == 2 %}播  放{% else %}进入直播
																			{% endif %}
																		</a>
																	{% else %}
																		<span class="name">
																			{{ loop.index }}、{{ item['name'] }}</span>
																		<a class="btn  btn-disabled btn-sm" href="javascript:;">暂无视频</a>
																	{% endif %}
																</li>
															</ul>
														</div>
													{% endif %}
												{% endfor %}
											</div>
										{% endif %}
									{% else %}
										{{ include('@WebsiteBundle/empty.html.twig',{msg:'数据为空!'}) }}
									{% endif %}
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		{{ render(path('app_footer')) }}
	</div>
{% endblock %}
